package com.example.sms_emoticon_library;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.GridView;
import android.widget.ImageView;

public class EmoticonsAdapter extends BaseAdapter {

	private Context mContext;
	private int []mEmoticonsId;
	
	public EmoticonsAdapter(Context context){
		mContext=context;
	}
	public EmoticonsAdapter(Context context, int []arrEmoticonsID){
		mContext= context;
		mEmoticonsId=arrEmoticonsID;
	}
	
	
	
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return mEmoticonsId.length;
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		ImageView imgView;
		if(convertView==null){
			imgView = new ImageView(mContext);	
			imgView.setLayoutParams(new GridView.LayoutParams(45, 45));
			imgView.setScaleType(ImageView.ScaleType.CENTER_CROP);
			
			//imgView.setPadding(3, 3, 3, 3);
		}else{
			imgView= (ImageView) convertView;
		}
		imgView.setImageResource(mEmoticonsId[position]);
		return imgView;
		
	}

}
